package com.example.mylibrarybase.yumengmeng15.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.mylibrarybase.R;
import com.example.mylibrarybase.yumengmeng15.utils.Utilsflexible;

/**
 * Created by 35876 于萌萌
 * 创建日期: 16:48 . 2016年10月24日
 * 描述:
 * <p>
 * <p>
 * 备注:
 */

public class flexibleRelativeLayout_15 extends RelativeLayout implements View.OnClickListener {

    private TextView mFlexiblelinearlayout_15_tv;
    private LinearLayout mFlexiblelinearlayout_15_ll;
    public CallBack mCallBack;
    private TextView tv_1;
    private TextView tv_2;

    public flexibleRelativeLayout_15(Context context) {
        super(context);
        initView(context);
    }

    public void  setCallBack(CallBack callBack){
        this.mCallBack = callBack;
    }
   public interface CallBack{
       void getTaginfo(boolean tag);
   }

    public flexibleRelativeLayout_15(Context context, AttributeSet attrs) {
        super(context, attrs);
        initView(context);
    }

    public flexibleRelativeLayout_15(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(context);
    }

    private void initView(Context context) {
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(context.LAYOUT_INFLATER_SERVICE);
        View inflate = inflater.inflate(R.layout.flexiblerelativelayout_15, this);

        mFlexiblelinearlayout_15_tv = (TextView) inflate.findViewById(R.id.flexiblelinearlayout_15_tv);
        tv_1 = (TextView) inflate.findViewById(R.id.tv_1);
        tv_2 = (TextView) inflate.findViewById(R.id.tv_2);
        mFlexiblelinearlayout_15_ll = (LinearLayout) inflate.findViewById(R.id.flexiblelinearlayout_15_ll);
        mFlexiblelinearlayout_15_tv.setTag(false);
        mFlexiblelinearlayout_15_ll.getLayoutParams().height = 0;
        mFlexiblelinearlayout_15_tv.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        if (view.getId()==R.id.flexiblelinearlayout_15_tv){
            mCallBack.getTaginfo((Boolean) mFlexiblelinearlayout_15_tv.getTag());
            Utilsflexible.sumbit(mFlexiblelinearlayout_15_tv,mFlexiblelinearlayout_15_ll);

        }
    }
}
